{% extends "wagtailadmin/base.html" %}
{% load i18n wagtailadmin_tags %}

{% block titletag %}{{ title }}{% endblock %}

{% block content %}
    {% fragment as report_actions %}
        <div class="report__actions">
            {% block actions %}
                {% if view.list_export %}
                    <div class="dropdown dropdown-button match-width">
                        <a href="{{ view.xlsx_export_url }}" class="button bicolor button--icon">{% icon name="download" wrapped=1 %}{% trans 'Download XLSX' %}</a>
                        <div class="dropdown-toggle">{% icon name="arrow-down" %}</div>
                        <ul>
                            <li><a  class="button bicolor button--icon" href="{{ view.csv_export_url }}">{% icon name="download" wrapped=1 %}{% trans 'Download CSV' %}</a></li>
                        </ul>
                    </div>
                {% endif %}
            {% endblock %}
        </div>
    {% endfragment %}

    {% include "wagtailadmin/shared/header.html" with title=title icon=header_icon merged=1 extra_actions=report_actions %}
    <div class="report{% if filters %} filterable{% endif %}">
        <div class="report__results">
            {% block results %}
            {% endblock %}
            {% if page_obj %}
                {% paginate page_obj base_url=request.path %}
            {% endif %}
        </div>
        {% if filters %}
            {% include "wagtailadmin/shared/filters.html" %}
        {% endif %}
    </div>
{% endblock %}

{% block extra_css %}
    {{ block.super }}
    {{ filters.form.media.css }}
{% endblock %}

{% block extra_js %}
    {{ block.super }}
    {{ filters.form.media.js }}
{% endblock %}
